import { _decorator, Component, Node } from 'cc';
import { ILevel, ITile } from '../Levels';
import Singleton from '../Base/Singleton';
import { TileManager } from '../Scripts/Tile/TileManager';
import { PlayerManager } from '../Scripts/Player/PlayerManager';
import { DoorManager } from '../Scripts/Door/DoorManager';
import { EnemyManager } from '../Base/EnemyManager';
import { BurstManager } from '../Scripts/Burst/BurstManager';
import { SpikesManager } from '../Scripts/Spikes/SpikesManager';
import { SmokeManager } from '../Scripts/Smoke/SmokeManager';

export type IRecord = Omit<ILevel, 'mapInfo'>

/**数据中心 */
export default class DataManager extends Singleton {
    static get Instance() {
        return super.getInstance<DataManager>();
    }

    mapInfo: Array<Array<ITile>>
    tileInfo: Array<Array<TileManager>>
    mapRowCount: number = 0
    mapColumnCount: number = 0
    levelIndex: number = 1
    player: PlayerManager
    door: DoorManager
    bursts: BurstManager[]
    enemies: EnemyManager[]
    spikes: SpikesManager[]
    smokes: SmokeManager[]
    /**记录 */
    records: IRecord[]

    reset() {
        this.mapInfo = [];
        this.tileInfo = [];
        this.player = null
        this.door = null
        this.bursts = []
        this.enemies = []
        this.records = []
        this.spikes = []
        this.smokes = []
        this.mapRowCount = 0;
        this.mapColumnCount = 0;
    }
}
